/**
 *  ward @ 2019
 *  harrydeep@wardyan.top
 */
package top.wardyan.po;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

import top.wardyan.base.config.Const;

/**
 * 
 * @author ward 2019年2月24日
 */
public class WText extends Text{
	
	/** 返回最右下角的那个点 **/
	protected Point bottom;
	
	
	public WText(Composite parent) {
		this(parent, null, null, Const.FONT_H6);
	}
	
	public WText(Composite parent, Rectangle bound) {
		this(parent, bound, null, Const.FONT_H6);
	}
	
	public WText(Composite parent, Rectangle bound, Font font) {
		this(parent, bound, null, font);
	}
	
	public WText(Composite parent, Rectangle bound, String defValue, Font font) {
		super(parent, SWT.BORDER);
		if(bound != null)
			this.setBounds(bound);
		this.setFont(font);
		this.setText(defValue != null ? defValue : "");
		
		this.setBottom();
	}
	
	
	/** 取得控件的最右下角的那个点 **/
	public Point getBottom() {
		return this.bottom;
	}
	
	protected void setBottom() {
		this.bottom = new Point(this.getLocation().x + this.getSize().x, this.getLocation().y + this.getSize().y);
	}

	
	@Override
	protected void checkSubclass() {}
}
